#! /bin/bash

hive  -S -e  "
drop table if exists bxg_dws.dws_signup_daycount;
-- 报名主题日统计宽表
create table bxg_dws.dws_signup_daycount(
-- 维度
    year                        string comment '年',
    year_month                  string comment '年月',
    year_month_day              string comment '年月日',
    school_id                   int comment '校区Id',
    school_name                 string comment '校区名称',
    origin_type                 string comment '上课方式:线上线下',
    subject_id                  int comment '学科Id',
    subject_name                string comment '学科名称',
    origin_channel              string comment '来源渠道',
    department_id               string comment '咨询新中心id',
    department_name             string comment '咨询中心名称',
    group_type                  string comment '分组类型：校区，学科，来源渠道，咨询中心，上课方式',
--指标
    signup_count                bigint comment '报名人数',
    relationship_count          bigint comment '意向人数',
    valid_clue_count            bigint comment '有效线索数量'
) comment '报名主题宽表'
partitioned by (dt string)
row format delimited
fields terminated by '\t'
stored as orc
tblproperties ('orc.compress'='SNAPPY');
"